package com.jthinker.dao.impl;

import com.jthinker.dao.BaseDao;
import com.jthinker.dao.RoleDao;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * Created by chen.gang on 2015/2/14.
 */
@Repository
public class RoleDaoImpl implements RoleDao
{
    @Resource
    private BaseDao baseDao;

    @Override
    public Map<String, Object> findOne(Long roleId)
    {
        return baseDao.read("SELECT * FROM sys_role WHERE id = ?", roleId);
    }

    @Override
    public Set<String> findPermissions(Long... roleIds)
    {
        Set<String> permissions = new HashSet<String>();

        for (Long roleId : roleIds)
        {
            Map<String, Object> role = findOne(roleId);

            //            if (role != null && StringUtils.isNoneBlank(role.getString("123")))
            //            {
            //                permissions.add(role.getString("123"));
            //            }
        }

        return null;
    }
}
